﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Slb.Ocean.Core;
using Slb.Ocean.Petrel.IO.Attributes;

namespace Public.Ocean.Petrel.Extensions.Attributes
{
    public sealed class GenericAttributes : CustomAttributesBase
    {
        const string NAMESPACE = "";

        public GenericAttributes() { }

        public string this[string key]
        {
            get { return GetValue(NAMESPACE, key); }
            set { SetValue(NAMESPACE, key, value); }
        }

        public string Get(string key) { return GetValue(NAMESPACE, key); }
        public TValue Get<TValue>(string key) { return GetTypedValue<TValue>(NAMESPACE, key); }
        public void Set(string key, string value) { SetValue(NAMESPACE, key, value); }
        public void Set<TValue>(string key, TValue value) { SetTypedValue<TValue>(NAMESPACE, key, value); }

        public IDictionary<string, string> GetAttributes()
        {
            return ToDictionary(NAMESPACE);
        }
    }
}
